<!--#Include File="../../Include.asp"--><%
Dim skin
Dim TempDir
Init()
'skin = Request.QueryString("skin")
Set Rs = Conn.execute("select top 1 * From [Fk_QQ_Set]")
skin = Rs("skin")
Rs.Close

TempDir=SiteDir
Dim path
If skin="" Then skin="default"
path = "./"&skin&"/qq.js"

Dim js
js = FKFun.FsoFileRead(path)

Dim loopStr,AfterStr,js1,js2,tmpstr
js1 = Split(js,"{loop}")
js2 = Split(js1(1),"{/loop}")
loopStr = js2(0)

AfterStr = ""
tmpstr=""

Sqlstr="Select title,qq From [Fk_QQ] order by ordnum desc"
Rs.Open Sqlstr,Conn,1,1
If Not Rs.Eof Then
	While Not Rs.Eof
		tmpstr = loopStr
		tmpstr = Replace(tmpstr,"{$QQ}",Rs("qq"))
		tmpstr = Replace(tmpstr,"{$title}",Rs("title"))
		AfterStr = AfterStr & tmpstr
		Rs.MoveNext
	Wend
Else
	Rs.Close
	Response.End()
End If
Rs.Close

js = Replace(js,loopStr,AfterStr)
js = Replace(js,"{loop}","")
js = Replace(js,"{/loop}","")
js = Replace(js,"{@skin}",TempDir & "Plugin/QQ/" & skin &"/")

response.ContentType="application/x-javascript"
Response.write(js)
Response.End()

Sub Init()
	On Error Resume Next
	Rs.Open "[Fk_QQ]",Conn,1,1
	If Not Err.number=0 Then
		Err.Clear
		Conn.execute("Create TABLE [Fk_QQ]([id] AUTOINCREMENT(1,1) NOT NULL, [title] varchar(50), [qq] varchar(50), [ordnum] SmallInt,primary key(id));")
		Rs.Close
	End If
	Rs.Close
	Rs.Open "[Fk_QQ_Set]",Conn,1,1
	If Not Err.number=0 Then
		Err.Clear
		Conn.execute("Create TABLE [Fk_QQ_Set]([id] AUTOINCREMENT(1,1) NOT NULL, [skin] varchar(50),primary key(id));")
		Conn.execute("INSERT INTO [Fk_QQ_Set] (skin) VALUES('default');")
		Rs.Close
	End If
	Rs.Close
End Sub
%>